<?php


namespace app\controller\coach;


use app\BaseController;
use app\service\utils\UploadService;

class FileController extends BaseController
{
    /**
     * 图片上传
     * @return \think\response\Json
     */
    public function upload()
    {
        try {
            $uid = $this->request->middleware('userId');
            $file = $this->request->file('file');
            $result = UploadService::upload($uid, $file, 1);
            return $this->success($result);
        } catch (\Exception $exception) {
            return $this->error($exception);
        }
    }
}